<?php
declare (strict_types=1);

namespace app\common\tool\pay;

class PayPreset
{
    /**
     * @var array 支付所需参数
     */
    protected $config;

    /**
     * @var string 支付标题
     */
    protected $subject;

    /**
     * @var string 订单号
     */
    protected $out_trade_no;

    /**
     * @var string 支付类型
     */
    protected $trade_type;

    /**
     * @var string 支付金额
     */
    protected $total;

    /**
     * @var string openid - 微信某些支付场景会用到
     */
    protected $openid;

    /**
     * @var string 回调地址
     */
    protected $notify_url;

    /**
     * @var string 同步跳转地址
     */
    protected $redirect_url;

    /**
     * @var null 定义单例
     */
    private static $_instance = null;


    public static function Instance()
    {
        if (empty(self::$_instance)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    public function getConfig()
    {
        return config('pay');
    }

    public function setConfig($name = [])
    {
        $this->name = $name;
        return $this;
    }

    public function getSubject()
    {
        return $this->subject;
    }

    public function setSubject($subject)
    {
        $this->subject = $subject;
        return $this;
    }

    public function getOutTradeNo()
    {
        return $this->out_trade_no;
    }

    public function setOutTradeNo($out_trade_no)
    {
        $this->out_trade_no = $out_trade_no;
        return $this;
    }

    public function getTradeType()
    {
        return $this->trade_type;
    }

    public function setTradeType($trade_type)
    {
        $this->trade_type = $trade_type;
        return $this;
    }

    public function getTotal()
    {
        return $this->total;
    }

    public function setTotal($total)
    {
        $this->total = $total;
        return $this;
    }

    public function getOpenId()
    {
        return $this->openid;
    }

    public function setOpenId($openid)
    {
        $this->openid = $openid;
        return $this;
    }

    public function getNotifyUrl()
    {
        return $this->notify_url;
    }

    public function setNotifyUrl($notify_url)
    {
        $this->notify_url = $notify_url;
        return $this;
    }

    public function getRedirectUrl()
    {
        return $this->redirect_url;
    }

    public function setReturnUrl($redirect_url)
    {
        $this->redirect_url = $redirect_url;
        return $this;
    }

}